package Thread;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LianBao
 * Date: 2024-08-02
 * Time: 21:51
 */
public class demo18 {
    private static volatile int a = 0;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Thread t1 = new Thread(() -> {
            while (a == 0) {

            }
            System.out.println("t1循环结束");
        });
        Thread t2 = new Thread(() -> {
            System.out.println("输入一个整数");
            a = scanner.nextInt();
        });
        t1.start();
        t2.start();
    }
}
